/* SPDX-License-Identifier: GPL-2.0-or-later
 *
 * Copyright (C) 2016-2018, LomboTech Co.Ltd.
 * Authors:
 *	lomboswer <lomboswer@lombotech.com>
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

#ifndef __PANEL_LOMBO_SIMPLE_H__
#define __PANEL_LOMBO_SIMPLE_H__

#include <drm/drmP.h>
#include <drm/drm_panel.h>
#include <drm/drm_mipi_dsi.h>
#include "../lombo/lombo_vo_manage.h"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */

typedef enum init_panel_type {
	PANEL_SIMPLE_NONE = 0,
	PANEL_SIMPLE_DSI = 1,
	PANEL_SIMPLE_CPU = 2,
	PANEL_SIMPLE_I2C = 3,
	PANEL_SIMPLE_SPI = 4,
	PANEL_SIMPLE_SPI_GPIO = 5,
} init_panel_type_t;

struct panel_lombo_simple_desc {
	struct drm_display_mode *modes;
	unsigned int num_modes;

	unsigned int bpc;
	init_panel_type_t init_panel;

	struct {
		unsigned int width;
		unsigned int height;
	} size;

	struct panel_delay {
		unsigned int reset;
		unsigned int prepare;
		unsigned int enable;
		unsigned int disable;
		unsigned int unprepare;
	} delay;

	lombo_vo_dev_if_t interface;
	u32 cmd_align;
	unsigned long flag;
	enum lombo_vo_pixel_format format;
	unsigned int lanes;
	enum mipi_dsi_pixel_format dsi_fmt;
};

int panel_lombo_simple_update_init_code(struct drm_panel *panel,
	u8 *init_code, u32 init_code_num);
int panel_lombo_simple_reconfig(struct drm_panel *panel,
	struct panel_lombo_simple_desc *desc);
bool panel_lombo_simple_config_change(struct drm_panel *panel,
	struct panel_lombo_simple_desc *desc);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */

#endif /*__PANEL_LOMBO_SIMPLE_H__ */
